package com.example.bootdemo1.controller;

import com.example.bootdemo1.pojo.Student;
import com.example.bootdemo1.service.IStudentService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 宋伟宁
 * @Date 2023/10/24
 * @Version 1.0
 **/
@RestController
@RequestMapping("/student")
public class StudentController {
    @Resource
    private IStudentService studentService;

    @GetMapping("/")
    public List<Student> stus(){
        return this.studentService.findAll();
    }

    @PostMapping("/")
    public boolean add(@RequestBody  Student student){
         int m=this.studentService.add(student);
         return  m>=1 ? true: false;
    }
}
